package training;

import java.util.Arrays;

/**
 * @Author liangzai
 * @Description:
 */
public class J25_7_13_Training {
    //运动员和训练师的最大匹配数
    public int matchPlayersAndTrainers(int[] players, int[] trainers) {
        Arrays.sort(players);
        Arrays.sort(trainers);
        int i = 0, j = 0;
        int m = players.length, n = trainers.length;
        int ans = 0;
        while(i < m && j < n){
            if(players[i]<=trainers[j]){
                ++ans;
                ++i;
            }
            ++j;
        }
        return ans;
    }
}
